package com.seari.config;

import com.seari.utils.InfluxDBConnUtils;
import com.seari.utils.PropertiesUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class InfluxDBConfiguration {

//    private static String username = PropertiesUtil.getProperty("commonConfig.properties", "username");
//    private static String password = PropertiesUtil.getProperty("commonConfig.properties", "password");
    private static String openurl = PropertiesUtil.getProperty("commonConfig.properties", "openurl");
    private static String database = PropertiesUtil.getProperty("commonConfig.properties", "database");

    @Bean
    public InfluxDBConnUtils getInfluxDBConnect(){
        InfluxDBConnUtils influxDB = new InfluxDBConnUtils(openurl, database);
        influxDB.influxDbBuild();
        influxDB.createRetentionPolicy();
        return influxDB;
    }
}
